home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cc02.zip / CRYPT.C < prev    next >
Text File  |  1985-08-28  |  624b  |  28 lines

  1. /* crypt.c by Michael Hanson */
  2. /* you may use this, but not for profit, and give me credit */ 
  3. /* encryption program, decryption program */
  4. #include "stdio.h"
  5. #include "errs.c"
  6. #include "version.c"
  7. #include "filp.c"
  8.  
  9. main(argc,argv)
  10. int argc;
  11. char *argv[];
  12. {
  13.     int c,i,keylen;
  14.  
  15.     if(ver() < 0x200){
  16.         error("wrong DOS version",1);
  17. #asm
  18.     db 'by Michael Hanson v1.0',1ah
  19. #    
  20.     }
  21.      if ((argc > 1) && ((keylen = strlen(argv[1])) > 0))
  22.         for (i=0; (c=getc(STDIN)) != EOF; i =(++i % keylen))
  23.             putc((char)((char)c ^ (argv[1])[i]),STDOUT);
  24.                 /* xor c key[i] */
  25.         else
  26.             error("usage: crypt key.",1);
  27. }
  28.